{% extends "show_analysis.html" %}

{% block analysis_result %}

    <table class="table table-bordered">
        <colgroup>
             <col style="width: 12.5%">
             <col style="width: 87.5%">
        </colgroup>
        <thead class="thead-light">
            <tr>
                <th colspan=2> Showing Analysis: {{ selected_analysis | replace_underscore}}</th>
            </tr>
        </thead>
        <tbody class="table-analysis">
            {% if analysis_result['skipped'] %}
            <tr>
                <td class="table-warning">Analysis was skipped</td>
                <td>{{ analysis_metadata['skipped'] }}</td>
            </tr>
            {% endif %}
            {% if analysis_metadata['analysis_date'] %}
            <tr>
                <td class="table-head-light">Time of Analysis</td>
                <td>{{ analysis_metadata['analysis_date'] | nice_unix_time }}</td>
            </tr>
            {% endif %}

            {% set version_backend = analysis_plugin_dict[selected_analysis][3] %}
            {% set version_database = analysis_metadata['plugin_version'] %}

            {% if selected_analysis == 'unpacker' or version_database | version_is_compatible(version_backend, True) %}
                {% if analysis_metadata['plugin_version'] %}
                <tr>
                    <td class="table-head-light">Plugin Version</td>
                    <td>{{ analysis_metadata['plugin_version']}}</td>
                </tr>
                {% endif %}
                {% if analysis_metadata['system_version'] %}
                <tr>
                    <td class="table-head-light">System Version</td>
                    <td>{{ analysis_metadata['system_version']}}</td>
                </tr>
                {% endif %}
                {% if analysis_result is not none and 'skipped' not in analysis_result %}
                    {% block analysis_result_details %}

                    {% endblock %}
                {% endif %}
            {% else %}
                <tr>
                    <td class="table-warning">Analysis outdated</td>
                    <td>
                        The backend plugin version ({{ version_backend | string }}) is incompatible with
                        the version ({{ version_database | string }}) of the analysis result.

                        Please update the analysis.
                    </td>
                </tr>
            {% endif %}
        </tbody>
    </table>

    {% block ajax %}
    {% endblock %}
{% endblock %}
